
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies","go_repository")

def go_repository_git():
    # https://github.com/bazelbuild/rules_go/blob/master/go/tools/fetch_repo/main.go:34
    # go_repository 用法
    # https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.rst
    go_repository(
        name = "org_golang_x_tools",
        importpath = "golang.org/x/tools",
        remote = "https://gitee.com/whatdy/org_golang_x_tools",
        # tag = "master"
        commit = "589c23e65e65055d47b9ad4a99723bc389136265",  # master, as of 2019-07-20
        patches = [
            "@io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch",
            "@io_bazel_rules_go//third_party:org_golang_x_tools-extras.patch",
        ],
        patch_args = ["-p1"],
        vcs = "git",
    )

    go_repository(
        name = "com_google_protobuf",
        remote = "https://gitee.com/githubClone/com_google_protobuf",
        importpath = "github.com/protocolbuffers/protobuf",
        commit = "582743bf40c5d3639a70f98f183914a2c0cd0680",  # v3.7.0,     as of 2019-03-03
        vcs = "git",
    )
    go_repository(
        name = "org_golang_x_net",
        remote = "https://gitee.com/whatdy/org_golang_x_net",
        importpath = "golang.org/x/net",
        commit = "16b79f2e4e95ea23b2bf9903c9809ff7b013ce85",  # master, as of 2019-03-3
        patches = ["@io_bazel_rules_go//third_party:org_golang_x_net-gazelle.patch"],
        patch_args = ["-p1"],
        vcs = "git",
    )
    go_repository(
        name = "org_golang_google_genproto",
        remote = "https://gitee.com/githubClone/org_golang_google_genproto",
        commit = "4f5b463f9597cbe0dd13a6a2cd4f85e788d27508",  # master, as of 2019-03-03
        importpath = "github.com/google/go-genproto",
        patches = ["@io_bazel_rules_go//third_party:org_golang_google_genproto-gazelle.patch"],
        patch_args = ["-p1"],
        vcs = "git",
    )

    go_repository(
        name = "com_github_gogo_protobuf",
        remote = "https://gitee.com/githubClone/com_github_gogo_protobuf",
        importpath = "github.com/gogo/protobuf",
        commit = "ba06b47c162d49f2af050fb4c75bcbc86a159d5c",  # v1.2.1, as of 2019-03-03
        patches = ["@io_bazel_rules_go//third_party:com_github_gogo_protobuf-gazelle.patch"],
        patch_args = ["-p1"],
        vcs = "git",
    )

    go_repository(
        name = "org_golang_x_text",
        remote = "https://gitee.com/whatdy/org_golang_x_text",
        importpath = "golang.org/x/text",
        commit = "f21a4dfb5e38f5895301dc265a8def02365cc3d0",  # v0.3.0, latest as of 2019-03-03
        patches = ["@io_bazel_rules_go//third_party:org_golang_x_text-gazelle.patch"],
        patch_args = ["-p1"],
        vcs = "git",
    )

    go_repository(
        name = "org_golang_google_grpc",
        remote = "https://gitee.com/whatdy/org_golang_google_grpc",
        importpath = "github.com/grpc/grpc-go",
        commit = "2fdaae294f38ed9a121193c51ec99fecd3b13eb7",  # v1.19.0, latest as of 2019-03-03
        patches = [
           "@io_bazel_rules_go//third_party:org_golang_google_grpc-gazelle.patch",
           "@io_bazel_rules_go//third_party:org_golang_google_grpc-crosscompile.patch",
        ],
        patch_args = ["-p1"],
        vcs = "git",
    )


    go_repository(
        name = "go_googleapis",
        remote = "https://gitee.com/whatdy/go_googleapis",
        importpath = "github.com/googleapis/googleapis",
        commit = "41d72d444fbe445f4da89e13be02078734fb7875",  # master, as of 2019-03-03
        patches = [
            "@io_bazel_rules_go//third_party:go_googleapis-deletebuild.patch",
            "@io_bazel_rules_go//third_party:go_googleapis-directives.patch",
            "@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch",
            "@io_bazel_rules_go//third_party:go_googleapis-fix.patch",
        ],
        patch_args = ["-E", "-p1"],
        vcs = "git",
    )
    go_repository(
        name = "com_github_golang_protobuf",
        remote = "https://gitee.com/whatdy/com_github_golang_protobuf",
        importpath = "github.com/golang/protobuf",
        commit = "c823c79ea1570fb5ff454033735a8e68575d1d0f",  # v1.3.0, as of 2019-03-03
        patch_args = ["-p1"],
        patches = ["@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch"],
        vcs = "git",
    )
    go_repository(
        name = "org_golang_x_sys",
        remote = "https://gitee.com/whatdy/org_golang_x_sys",
        importpath = "golang.org/x/sys",
        commit = "d455e41777fca6e8a5a79e34a14b8368bc11d9ba",  # v1.3.0, as of 2019-03-03
        patch_args = ["-p1"],
        patches = ["@io_bazel_rules_go//third_party:org_golang_x_sys-gazelle.patch"],
        vcs = "git",
    )
